<template>
	<om-page :title="pageTitle">
		<uni-list>
			<uni-list-item @click="openPopup()">
				 <view slot="header" >
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">组织名称</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.orgname }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">组织简称</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.shortname }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">成立日期</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.establishDate ? orgDetail.establishDate.substring(0,10) : '' }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">统一社会信用代码</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.regcode }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">法定代表人</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.legalmanName }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">注册地址</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ orgDetail.regaddress }}</view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">使命</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ dataDetail.mission }}<image src="@/static/images/others/look.png" class="look" v-show="dataDetail.mission" @click.stop="detailModal(1)"></image></view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">愿景</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">{{ dataDetail.vision }}<image src="@/static/images/others/look.png" class="look" v-show="dataDetail.vision" @click.stop="detailModal(2)"></image></view>
					</view>
					<view class="tui-flex align-center om-font-size">
						 <view class="tui-right show-label" style="font-size: 16px; width:250rpx;">价值观</view>
						 <p>{{'\xa0'}}</p>
						 <view class="" style="width:350rpx;">
							 <view v-for="item in dataDetail.dataList">{{ item.cultureContent }}<image src="@/static/images/others/look.png" class="look" v-show="dataDetail.vision" @click.stop="detailModal(3,item)"></image></view>
						 </view>
					</view>
				 </view>
			</uni-list-item>
		</uni-list>
		<uni-popup  id="popup" ref="popup" :type="'center'">
			<view class="popup-cotent padding">
				<view class="margin popup-tip">
					请选择查询项目
				</view>
				<view class="popup-item padding" @click="infoTab(1)">
					<text>中期目标</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="popup-item padding" @click="infoTab(2)">
					<text>年度目标</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="popup-item padding" @click="infoTab(3)">
					<text>年度指标</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="popup-item padding" @click="infoTab(4)">
					<text>年度重点工作</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="popup-item padding" @click="infoTab(5)">
					<text>机构列表</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="popup-item padding" @click="infoTab(6)">
					<text>机构图</text>
					<uni-icons :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
				</view>
				<view class="margin flex justify-end" @click="cancel">
					<a class="cancel-btn">取消</a>
				</view>
			</view>
		</uni-popup>
	</om-page>
</template>

<script>
	import {
		ignoreHtml,
	} from '@/static/js/common.js';
	export default {
		data() {
			return {
				pageTitle:"组织信息查询",
				orgDetail: {},
				dataDetail: {},
			};
		},
		methods: {
			infoTab(num){
				if(num == 1){
					uni.navigateTo({
					    url: '/pages/search/metaphase-goal-search/metaphase-goal-search'
					})
				}
				if(num == 2){
					uni.navigateTo({
					    url: '/pages/search/goal-search/goal-search'
					})
				}
				if(num == 3){
					uni.navigateTo({
					    url: '/pages/search/quota-search/quota-search'
					})
				}
				if(num == 4){
					uni.navigateTo({
					    url: '/pages/search/workitem-search/workitem-search'
					})
				}
				if(num == 5){
					uni.navigateTo({
					    url: '/pages/search/orgin-search/orgin-treelist'
					})
				}
				if(num == 6){
					uni.navigateTo({
					    url: '/pages/search/orgin-search/orgin-tree'
					})
				}
			},
			detailModal(num, desc){
				let _that = this;
				if(num == 1){
					uni.showModal({
						title: '使命',
						content: ignoreHtml(_that.dataDetail.missionExplain),
						showCancel: false,
						success(res){
							
						}
					})
				}
				if(num == 2){
					uni.showModal({
						title: '愿景',
						content: ignoreHtml(_that.dataDetail.visionExplain),
						showCancel: false,
						success(res){
							
						}
					})
				}
				if(num == 3){
					uni.showModal({
						title: '价值观：'+desc.cultureContent,
						content: ignoreHtml(desc.cultureExplain),
						showCancel: false,
						success(res){
							
						}
					})
				}
			},
			openPopup(){
				this.$refs.popup.open()
			},
			cancel(){
				this.$refs.popup.close()
			},
		},
		onLoad(data) {
			let _that = this;
			
			uni.setNavigationBarTitle({
				title: '组织信息查询'
			});
			
			let arr = [_that.om.request("/torganization/getOrgById"),
			 _that.om.request("/orgCulture/getLastData",{
				 ignoreVerify:true
			 })]
			//多个AJAX全部完成时开始执行
			Promise.all(arr).then(res => {
				if(res[0].succeed){
					_that.orgDetail = res[0].value
				}
				if(res[1].succeed){
					_that.dataDetail = res[1].value
					// if(_that.dataDetail.dataList.length>0){
					// 	_that.dataDetail.jzgdesc = ''
					// 	// _that.dataDetail.dataList.map(e=>e.cultureContent)
					// }else{
					// 	_that.dataDetail.jzgdesc = ''
					// }
				}
			})
		},
	};
</script>

<style>
	.popup-item{
		height:50px;
		background-color: #FFFF;
		font-size: 16px;
		text-align: center;
		border-bottom: 1px solid #EEEEEE;
		display: flex;
		justify-content: space-between;
	}
	.popup-cotent{
		width: 300px;
		background-color: white;
		border-radius: 10px;
	}
	.popup-tip{
		font-size: 16px;
		color:#b0b0b0 ;
	}
	.cancel-btn{
		text-align: center;
		display: block;
		color: #0081ff;
		background-color: #cce6ff;
		height: 36px;
		line-height: 36px;
		width: 72px;
		margin: 15px auto 0;
	}
	.dbtn{
		width: 64px;
		height: 32px;
		font-size: 14px;
		margin-bottom:3px;
		margin-left:3px;
	}
	.look{
		width: 16px;
		height: 16px;
		margin-left: 5px;
	}
</style>                                                  
